package com.lbmb.photodrawaimanager.controller;

import com.lbmb.photodrawaimanager.entity.req.PhotoUserUploadReq;
import com.lbmb.photodrawaimanager.service.PhotoUserUploadService;
import com.lbmb.photodrawaimanager.utils.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author hanWang
 * @Title:
 * @Package
 * @Description:
 * @date 2023/8/612:00 下午
 */
@RestController
@RequestMapping("/api/v1/photo/user/upload")
public class PhotoUserUploadController {

    @Autowired
    PhotoUserUploadService photoUserUploadService;

    @PostMapping("/select_list")
    public Response<?> selectUserUpLoadByUserId(@RequestBody PhotoUserUploadReq photoUserUploadReq){

        return  Response.ok(photoUserUploadService.selectUserUpLoadByUserId(photoUserUploadReq));
    }

    @PostMapping("/create")
    public Response<?> create(@RequestPart(value = "file", required = true) MultipartFile file,@RequestPart(value = "param")PhotoUserUploadReq req){
//        PhotoUserUploadReq req = new PhotoUserUploadReq();
//        req.setModuleId(moduleId);
        return  Response.ok(photoUserUploadService.insert(req,file));
    }

//    @PostMapping("/create/{moduleId}")
//    public Response<?> create(@RequestPart(value = "file", required = true) MultipartFile file,@PathVariable Long moduleId){
//        PhotoUserUploadReq req = new PhotoUserUploadReq();
//        req.setModuleId(moduleId);
//        return  Response.ok(photoUserUploadService.insert(req,file));
//    }

}
